from flask import Flask, request

app = Flask(__name__)

@app.route('/',methods=['POST','GET'])
def index():
    # 1.获取查询字符串
    # print(request.args)
    # num=request.args.get('num')
    # print(num)

    # 2.获取表单数据
    # name = request.form.get('name')
    # print(name)

    # 3.获取原始数据
    # print(request.data.decode())

    # 4.获取请求路径
    # print(request.url)

    # 5.获取请求方式
    # if request.method == 'GET':
    #     return 'You are GET'
    # elif request.method == 'POST':
    #     return 'You are POST'

    # 6.获取请求头
    # print(request.headers.get('User-Agent'))

    # 7.获取文件
    # file1 = request.files.get('file1')
    # file1.save('file1.png')
    # file1.save('file1.filename')

    return 'index'

if __name__ == '__main__':
    app.run(debug=True)